package _993KongDuiXiang.factory;

import _993KongDuiXiang.AbstractCustomer;
import _993KongDuiXiang.sub.NullCustomer;
import _993KongDuiXiang.sub.RealCustomer;

/**
 * @CustomerFactory: 对象工厂
 * @author: ZBoHang
 * @time: 2021/9/17 16:42
 */
public class CustomerFactory {
    private static final String[] names = {"Rob","Joe","Julie"};
    public static AbstractCustomer getCustomer(String name) {
        for (int i = 0, len = names.length; i < len; i++) {
            if (names[i].equals(name)) {
                return new RealCustomer("name");
            }
        }
        return new NullCustomer();
    }
}
